import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { NotFixedAssetLedgerVO, NotFixedAssetLedgerForm, NotFixedAssetLedgerQuery } from '@/api/business/notFixedAssetManagement/ledger/types';

/**
 * 查询资产台账列表
 * @param query
 * @returns {*}
 */

export const listAssetLedger = (query?: NotFixedAssetLedgerQuery): AxiosPromise<NotFixedAssetLedgerVO[]> => {
  return request({
    url: '/business/assetLedger/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询资产台账详细
 * @param id
 */
export const getAssetLedger = (id: string | number): AxiosPromise<NotFixedAssetLedgerVO> => {
  return request({
    url: '/business/assetLedger/' + id,
    method: 'get'
  });
};

/**
 * 新增资产台账
 * @param data
 */
export const addAssetLedger = (data: NotFixedAssetLedgerForm) => {
  return request({
    url: '/business/assetLedger',
    method: 'post',
    data: data
  });
};

/**
 * 修改资产台账
 * @param data
 */
export const updateAssetLedger = (data: NotFixedAssetLedgerForm) => {
  return request({
    url: '/business/assetLedger',
    method: 'put',
    data: data
  });
};

/**
 * 删除资产台账
 * @param id
 */
export const delAssetLedger = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/assetLedger/' + id,
    method: 'delete'
  });
};
